<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<!--[if lt IE 9]>
<script type="text/javascript" src="lib/html5.js"></script>
<script type="text/javascript" src="lib/respond.min.js"></script>
<script type="text/javascript" src="lib/PIE_IE678.js"></script>
<![endif]-->
<link href="<?=base_url('publics/admin');?>/css/H-ui.min.css" rel="stylesheet" type="text/css" />
<link href="<?=base_url('publics/admin');?>/css/H-ui.admin.css" rel="stylesheet" type="text/css" />
<link href="<?=base_url('publics/admin');?>/lib/font-awesome/font-awesome.min.css" rel="stylesheet" type="text/css" />
<!--[if IE 7]>
<link href="<?=base_url('publics/admin');?>/lib/font-awesome/font-awesome-ie7.min.css" rel="stylesheet" type="text/css" />
<![endif]-->
<link href="<?=base_url('publics/admin');?>/lib/iconfont/iconfont.css" rel="stylesheet" type="text/css" />
<!--[if IE 6]>
<script type="text/javascript" src="<?=base_url('publics/admin');?>/lib/DD_belatedPNG_0.0.8a-min.js" ></script>
<script>DD_belatedPNG.fix('*');</script>
<![endif]-->
<title>会员管理</title>
</head>
<body>
<nav class="breadcrumb">
	<i class="iconfont">&#xf012b;</i> 首页
	<span class="c-gray en">&gt;</span> 订单管理 
	<span class="c-gray en">&gt;</span> 订单列表
	<a class="btn btn-success radius r mr-20" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" ><i class="icon-refresh"></i></a></nav>
<div class="pd-20">
	<div class="text-c">
	    <form class="Huiform" method="get" action="<?php echo base_url('manage/order/search');?>" target="_self">
	      产品: <span class="select-box" style="width:150px;">
	     
	        <?php if(!empty($_GET['product'])):?>
	      	 <select class="select" name="product" size="1">
		        <option value="all"  <?php if($_GET['product'] == 'all'):?>selected="true"<?php endif;?>>全部产品</option>
		        <option value="1" <?php if($_GET['product'] == '1'):?>selected="true"<?php endif;?>>产品1</option>
		        <option value="2" <?php if($_GET['product'] == '2'):?>selected="true"<?php endif;?>>产品2</option>
	      	</select>
	        <?php else:?>
		      <select class="select" name="product" size="1">
		        <option value="all" selected="true">全部产品</option>
		        <option value="1">产品1</option>
		        <option value="2">产品2</option>
		      </select>
	      	<?php endif;?>
	      </span>
	      状态: <span class="select-box" style="width:150px;">
	      <?php if(!empty($_GET['status'])):?>
	      <select class="select" name="status" size="1">
	      	<option value="all"  <?php if($_GET['status'] == 'all'):?>selected="true"<?php endif;?>>全部订单</option>
	        <option value="1" <?php if($_GET['status'] == '1'):?>selected="true"<?php endif;?>>失效</option>
			<option value="2"  <?php if($_GET['status'] == '2'):?>selected="true"<?php endif;?>>已处理</option>
			<option value="3" <?php if($_GET['status'] == '3'):?>selected="true"<?php endif;?>>处理中</option>
			<option value="4" <?php if($_GET['status'] == '4'):?>selected="true"<?php endif;?>>待处理</option>
	      </select>
	       <?php else:?>
		    <select class="select" name="status" size="1">
		      	<option value="all" selected="true">全部订单</option>
		        <option value="1">失效</option>
				<option value="2" >已处理</option>
				<option value="3" >处理中</option>
				<option value="4">待处理</option>
		      </select>
	       <?php endif;?>
	      </span>
		 <button type="submit" class="btn btn-success" id="" name=""><i class="icon-search"></i> 搜索</button>
	    </form>
  	</div>
  <div class="cl pd-5 bg-1 bk-gray mt-20">
  	<span class="l">
  	    <a href="" class="">&nbsp;</a>
  	</span>
  </div>
     <table class="table table-border table-bordered table-hover table-bg">
      <thead>
        <tr class="text-c">
          <th width="80">ID</th>
          <th>订单号</th>
          <th width="100">订单类别</th>
          <th width="150">产品名称</th>
          <th width="150">订单状态</th>
          <th width="150">下单时间</th>
        </tr>
      </thead>
      <tbody>
      <?php if(!empty($error)):?>
      	<tr  class="text-c">
        	<td colspan="7" ><?=$error;?></td>
        </tr>
      <?php else:?>
      <?php foreach($arr as $val):?>
  	  <tr class="text-c">
      	<td><?=$val['order_id'];?></td>
      		<td><a href="<?php echo base_url('manage/order/info');?>?id=<?=$val['order_id'];?>" title="订单详情"><?=$val['order_number'];?></a></td>
      	<td><?=$val['cate_name'];?></td>
      	<td>
      		<?php if($val['pro_id'] == 1):?>产品1
	      		<?php elseif($val['pro_id'] == 2):?>产品2
	      		<?php elseif($val['pro_id'] == 3):?>产品3
      		<?php endif;?>
      	</td>
      	<td>
      		<select name="status" id="status<?=$val['order_id'];?>" onchange="return update(<?=$val['order_id'];?>);">
				<option value="0" <?php if($val['status'] == 1):?>selected="true"<?php endif;?>>失效</option>
				<option value="1" <?php if($val['status'] == 2):?>selected="true"<?php endif;?> >已处理</option>
				<option value="2" <?php if($val['status'] == 3):?>selected="true"<?php endif;?>>处理中</option>
				<option value="3" <?php if($val['status'] == 4):?>selected="true"<?php endif;?>>待处理</option>
      		</select>
      	</td>
      	<td><?=date('Y-m-d H:i:s',$val['place_date']);?></td>
      
	   </tr>
       <?php endforeach;?>
      </tbody>
    </table>
	<div class="pageNav" id="pageNav">
		<?=$pager;?>
	</div>
	<?php endif;?>
</div>
<script type="text/javascript" src="<?=base_url('publics/admin');?>/lib/jquery.min.js"></script> 
<script type="text/javascript" src="<?=base_url('publics/admin');?>/lib/layer1.8/layer.min.js"></script> 
<script type="text/javascript" src="<?=base_url('publics/admin');?>/lib/laypage/laypage.js"></script> 
<script type="text/javascript" src="<?=base_url('publics/admin');?>/lib/My97DatePicker/WdatePicker.js"></script> 
<script type="text/javascript" src="<?=base_url('publics/admin');?>/lib/jquery.dataTables.min.js"></script>
<script type="text/javascript" src="<?=base_url('publics/admin');?>/js/H-ui.js"></script>  
<script type="text/javascript" src="<?=base_url('publics/admin');?>/js/H-ui.admin.js"></script>
<script type="text/javascript" src="<?=base_url('publics/admin');?>/js/H-ui.admin.doc.js"></script>
<script type="text/javascript">
$('.table-sort').dataTable({
	"lengthMenu":false,//显示数量选择 
	"bFilter": false,//过滤功能
	"bPaginate": false,//翻页信息
	"bInfo": false,//数量信息
	"aaSorting": [[ 1, "desc" ]],//默认第几个排序
	"bStateSave": true,//状态保存
	"aoColumnDefs": [
	  //{"bVisible": false, "aTargets": [ 3 ]} //控制列的隐藏显示
	  {"orderable":false,"aTargets":[0,8,9]}// 制定列不参与排序
	]
});

// 询问框
function deldata(id){
	$.layer({
	    shade: [0],
	    area: ['auto','auto'],
	    dialog: {
	        msg: '确定要删除该订单？',
	        btns: 2,                    
	        type: 4,
	        btn: ['是','否'],
	        yes: function(){
	            $.get("order/delete?id="+id,function(res){
					if(res == 'ok'){
						layer.msg('删除成功!', 1, 1);
						location.reload();
					}else{
					
						layer.msg('删除失败,请联系网站管理员!', 1, 3);
					}
				});
	        }, no: function(){}
	    }
	});
}
function update(id){
	var valData =  {
		'status'  : $('#status'+id).val()
	}

	$.ajax({
      type : 'POST',
      url  : '<?=base_url('manage/order/update');?>?id='+id,
      data : valData,
      success:function(msg){
        if(msg == 'ok'){
           location.href = '';
        }else{
           layer.msg('修改失败,请联系网站管理员,');
        }       
      }
  });
}
</script> 
</body>
</html>